package com.muyu.system.controller;


import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.system.domain.DanmoVipInfo;
import com.muyu.system.service.IDanmoVipInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * vip用户信息Controller
 * 
 * @author yl
 * @date 2025-06-10
 */
@RestController
@RequestMapping("/info")
public class DanmoVipInfoController extends BaseController
{
    @Autowired
    private IDanmoVipInfoService danmoVipInfoService;

    /**
     * 查询vip用户信息列表
     */
//    @RequiresPermissions("system:info:list")
    @PostMapping("/list")
    public Result<List<DanmoVipInfo>> list(@RequestBody  DanmoVipInfo danmoVipInfo)
    {

        List<DanmoVipInfo> list = danmoVipInfoService.selectDanmoVipInfoList(danmoVipInfo);
        return Result.success(list);
    }

    /**
     * 导出vip用户信息列表
     */
//    @RequiresPermissions("system:info:export")
    @Log(title = "vip用户信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DanmoVipInfo danmoVipInfo)
    {
        List<DanmoVipInfo> list = danmoVipInfoService.selectDanmoVipInfoList(danmoVipInfo);
        ExcelUtil<DanmoVipInfo> util = new ExcelUtil<DanmoVipInfo>(DanmoVipInfo.class);
        util.exportExcel(response, list, "vip用户信息数据");
    }

    /**
     * 获取vip用户信息详细信息
     */
//    @RequiresPermissions("system:info:query")
    @GetMapping(value = "/{id}")
    public Result getInfo(@PathVariable("id") Long id)
    {
        return success(danmoVipInfoService.selectDanmoVipInfoById(id));
    }

    /**
     * 新增vip用户信息
     */
//    @RequiresPermissions("system:info:add")
    @Log(title = "vip用户信息", businessType = BusinessType.INSERT)
    @PostMapping
    public Result add(@RequestBody DanmoVipInfo danmoVipInfo)
    {
        return danmoVipInfoService.insertDanmoVipInfo(danmoVipInfo);
    }

    /**
     * 修改vip用户信息
     */
//    @RequiresPermissions("system:info:edit")
    @Log(title = "vip用户信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public Result edit(@RequestBody DanmoVipInfo danmoVipInfo)
    {
        return danmoVipInfoService.updateDanmoVipInfo(danmoVipInfo);
    }

    /**
     * 删除vip用户信息
     */
//    @RequiresPermissions("system:info:remove")
    @Log(title = "vip用户信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids)
    {
        return danmoVipInfoService.deleteDanmoVipInfoByIds(ids);
    }
}
